Skip to content

feat: add HTTP debug logging#454

Open
nanookclaw wants to merge 1 commit into
elastic:mainfrom
Humans-Not-Required:feat/debug-http-logging
Open

feat: add HTTP debug logging#454
nanookclaw wants to merge 1 commit into
elastic:mainfrom
Humans-Not-Required:feat/debug-http-logging

Conversation

@nanookclaw

Copy link
Copy Markdown

Summary

Adds opt-in HTTP debug logging for CLI requests via --debug or ELASTIC_DEBUG=1. When enabled, the Elasticsearch, Kibana, and Elastic Cloud clients write request/response details to stderr so stdout remains machine-readable.

The logger redacts Authorization and X-Api-Key headers, clones response bodies before reading them, and falls back gracefully if a body cannot be cloned. Completion and CLI schema metadata now expose the new flag/environment variable as well.

Closes #316

Tests

  • npm run build
  • node --import tsx/esm --test test/lib/debug-http.test.ts test/lib/es-client.test.ts test/lib/kibana-client.test.ts test/lib/cloud-client.test.ts
  • node --import tsx/esm --test test/cli.test.ts
  • node --import tsx/esm --test test/completion/complete.test.ts
  • node --import tsx/esm --test test/factory.test.ts
  • npx eslint src/cli-schema.ts src/cli.ts src/completion/complete.ts src/lib/cloud-client.ts src/lib/debug-http.ts src/lib/es-client.ts src/lib/kibana-client.ts test/cli.test.ts test/completion/complete.test.ts test/lib/cloud-client.test.ts test/lib/debug-http.test.ts test/lib/es-client.test.ts test/lib/kibana-client.test.ts && git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): add --debug flag and ELASTIC_DEBUG env var for HTTP request logging

1 participant